<%@ page language="java" contentType="text/html; charset=utf-8"    pageEncoding="utf-8"%>
<%@include file="header.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=request.getContextPath() %>/ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/ext/ext-all.js"></script>

<title>Admin</title>
</head>
<style>
body {
	font-size:12px;
	color: #333333;
}
.am1 {
	background-color: #FFFFFF;
	background-image: url(../Images/tip.gif);
	background-repeat: no-repeat;
	background-position: 3px 2px;
	margin-left: 3px;
	padding-top: 6px;
	padding-right: 5px;
	padding-bottom: 6px;
	padding-left: 25px;
	border-bottom-width: 1px;
	border-bottom-style: dashed;
	border-bottom-color: #CCCCCC;
	border-right-width: 1px;
	border-right-style: dashed;
	border-right-color: #CCCCCC;
	color: #333333;
}
.am1 a:link {
	text-decoration: none;
	color: #333333;
}
.am1 a:active {
	color: #333333;
}
.am1 a:hover {
	color: #FF0000;
	text-decoration: none;
}
.am1 a:visited {
	text-decoration: none;
}

.am2 {
	background-color: #F9F9F9;
	background-repeat: no-repeat;
	background-position: right 2px;
	margin-left: 3px;
	padding-top: 3px;
	padding-right: 20px;
	padding-bottom: 3px;
	padding-left: 25px;
	color: #333333;
	text-align: right;
	margin-top: 5px;
	border: 1px solid #EBEBEB;
	background-image: url(../Images/Explain01.gif);
}
.am2 a:link {
	text-decoration: none;
	color: #333333;
}
.am2 a:active {
	color: #333333;
}
.am2 a:hover {
	color: #FF0000;
	text-decoration: none;
}
.am2 a:visited {
	text-decoration: none;
}
</style>
<script>
<%-- 
	Ext.require([
	    'Ext.tree.*',
	    'Ext.data.*'
	]);
	--%>
	function openwindow(url){
		window.open(url,"mainFrame");
	}
	Ext.onReady(function() {
	<%--
    	var store = Ext.create('Ext.data.TreeStore', 
    	{
 			proxy: {
              type: 'ajax',
              url: 'get-nodes.php',
              extraParams: {
                  isXml: true
              },
              reader: {
                  type: 'xml',
                  root: 'nodes',
                  record: 'node'
              }
			},
            sorters: [
           	{
                property: 'leaf',
                direction: 'ASC'
           	},
           	{
                property: 'text',
                direction: 'ASC'
           	}
           ],
        	root: {
             text: 'Ext JS',
             id: 'src',
             expanded: true
         	}
		});--%>
		
<%--
        var root = new Ext.tree.TreeNode({  
            text : '系统说明',  
            url : 'pagesExt/about.jsp',  
            expanded : true//默认展开根节点  
        });  
        var node1 = new Ext.tree.TreeNode({  
            text : '书籍类型维护',  
            url : 'bookext.do?method=showBookTypeList'  
        });  
        var node2 = new Ext.tree.TreeNode({  
            text : '书籍维护',  
            url : 'bookext.do?method=showBookList'  
        });  
        root.appendChild(node1);//添加子节点  
        root.appendChild(node2);//添加子节点  
    var tree = Ext.create('Ext.tree.Panel', {
        store: store,
        hideHeaders: true,
        rootVisible: true,
        viewConfig: {
            plugins: [{
                ptype: 'treeviewdragdrop'
            }]
        },
        height: 350,
        width: 400,
        title: 'Directory Listing',
//         renderTo: 'treeMenu',
        collapsible: true
    });
    var menu = new Ext.tree.TreePanel({  
        border : false,  
        root : root,  
        hrefTarget : 'mainContent',  
        listeners : {  
            click : function(node,e){  
                mainPanel.load({  
                    url:node.attributes.url,  
                    callback : function(){  
                        mainPanel.setTitle(node.text);  
                    },  
                    scripts: true  
                });  
            }  
        }  
        ,  
        tbar : [  
            '皮肤选择：',  
            {  
                xtype : 'themeChange',  
                width : 80,  
                listWidth : 80  
            },  
            '->'  
        ]  
    });   
	new Ext.Viewport({  
		title : 'Ext.Viewport示例',  
		layout:'border', 
		renderTo: 'treeMenu',
		items: [{  
		    title : '简易书籍管理系统ExtJs版',  
		    collapsible: true,  
		    html : '<br><center><font size = 6>简易书籍管理系统</font></center>',  
		    region: 'north', 
		    height: 100  
		},{  
		    title : '功能菜单',  
		    items : menu,  
		    split:true,  
		    collapsible: true,  
		    region:'west', 
		    width: 150  
		},{  
		    title: '系统说明',  
		    contentEl : 'aboutDiv',  
		    collapsible: true,  
		    id : 'mainContent',  
		    region:'center' 
		}]
	}
		);  
	--%>
	var store = Ext.create('Ext.data.TreeStore', {
	    root: {
	        expanded: true,
	        children: [
	            { text: "基础数据", expanded: true, children: [
	                { text: "颜色", leaf: true, id:'color' },
	                { text: "分类", leaf: true ,id:'catalog'},
	                { text: "配置", leaf: true ,id:'configuration'},
	                { text: "单位", leaf: true ,id:'unit'},
	                { text: "门店", leaf: true ,id:'shop'},
	                { text: "地区", leaf: true ,id:'area'},
	                { text: "部门", leaf: true ,id:'department'}
	            ] },
	            { text: "手机及配件", leaf: true , id: 'goods'},
	            { text: "权限管理", leaf: true , id: 'authorization'},
	            { text:"销售管理",expanded: true, children:[
	                                                    { text: "仓库", leaf: true , id: 'salestorehouse'},
	                                                    { text: "已销售", leaf: true , id: 'sale'}
	                                                    ]
	            },
	            { text: "仓储管理", leaf: true , id: 'storehouse'},
	            { text: "报表管理", leaf: true , id: 'reportManager'},
	            { text: "维修管理", leaf: true , id: 'repairManager'},
	            { text: "员工管理", leaf: true ,id:'employee'},
	            { text: "供应商管理", leaf: true ,id:'suppliers'},
	            { text: "会员管理", expanded:true,children:[ 
	                                                     {text:"会员管理", leaf: true ,id:'member'},
	                                                     {text:"消费记录查询", leaf: true ,id:'searchConsumeRecords'},
	                                                     {text:"消费Top", leaf: true ,id:'sortTopConsumeRecords'},
	                                                     {text:"上传Excel会员", leaf: true ,id:'uploadExcelMember'}
	                                                     ]
	            },
	            { text: "日志管理", leaf: true ,id:'logrecord'},
	            { text: "退出", leaf: true ,id:'logout'}
	            <% Object sessionObj = request.getSession().getAttribute("employee") ;
	             	if (sessionObj != null	 ) {
	             		pcjavanet.mobilesell.model.Employee bean = ( pcjavanet.mobilesell.model.Employee )sessionObj;
	            %>
	            ,
	            { text: "[<%=bean.getName()%>]", leaf: true ,id:'displayUser'},
	            <%}%>
	        ]
	    }
	});

	Ext.create('Ext.tree.Panel', {
	    title: '',
// 	    width: 200,
// 	    height: 150,
	    store: store,
	    rootVisible: false,
	    listeners:{
			itemclick:function(view,record,item,index){
				if( record.get('id') =='logout' ){
					
					
					Ext.Ajax.request({
						url:'<%=request.getContextPath() %>/employee/logout.action',
						success:function(response){
							window.parent.location.href="<%=request.getContextPath() %>/index.action";
						},
						failure:function(resposne){
							Ext.Msg.alert('Failure',response.responseText);
							globalMask.hide();
						}
// 						,
// 						params:{
// 							monitorId: "<s:property value='monitorId' />", 
// 							chartType: "Pareto",
// 							startDate: Ext.getCmp("<portlet:namespace/>startDate").getValue(),
// 							endDate: Ext.getCmp("<portlet:namespace/>endDate").getValue(),
// 							revision: Ext.getCmp("<portlet:namespace/>revisionCombo").getValue()
// 						}
					});
					
					//openwindow('sale/index.action');
				}
				if( record.get('id') =='sale' ){
					openwindow('sale/index.action');
				}
				if( record.get('id') =='storehouse' ){
					openwindow('storehouse/index.action');
				}
				if( record.get('id') =='reportManager' ){
					openwindow('reportManager/index.action');
				}
				if( record.get('id') =='repairManager' ){
					openwindow('repairManager/index.action');
				}
				if( record.get('id') =='logrecord' ){
					openwindow('logrecord/index.action');
				}
				if( record.get('id') =='goods' ){
					openwindow('goods/index.action');
				}
				if( record.get('id') =='catalog' ){
					openwindow('catalog/index.action');
				}
				if( record.get('id') =='unit' ){
					openwindow('unit/index.action');
				}
				if( record.get('id') =='employee' ){
					openwindow('employee/index.action');
				}
				if( record.get('id') =='configuration' ){
					openwindow('configuration/index.action');
				}
				if( record.get('id') =='department' ){
					openwindow('department/index.action');
				}
				if( record.get('id') =='color' ){
					openwindow('color/index.action');
				}
				if( record.get('id') =='catalog' ){
					openwindow('catalog/index.action');
				}
				if( record.get('id') =='authorization' ){
					openwindow('authorizations/index.action');
				}
				if( record.get('id') =='area' ){
					openwindow('area/index.action');
				}
				if( record.get('id') =='member' ){
					openwindow('member/index.action');
				}
				if( record.get('id') =='suppliers' ){
					openwindow('suppliers/index.action');
				}
				if( record.get('id') =='shop' ){
					openwindow('shop/index.action');
				}
				if( record.get('id') =='uploadExcelMember' ){
					openwindow('memberExcelUpload.action');
				}
				if( record.get('id') =='searchConsumeRecords' ){
					openwindow('searchConsumeRecords.action');
				}
				if( record.get('id') =='sortTopConsumeRecords' ){
					openwindow('sortTopConsumeRecords.action');
				}
				if( record.get('id') =='salestorehouse' ){
					openwindow('storehouse/SubStorehouse.action');
				}
			}
	    },
	    renderTo: Ext.getBody()
	});
});

	
</script>
<body>
<!-- 
<div class="am1"><a href="employee/index.action"  target="mainFrame">员工管理</a></div>
 
 
<div class="am1"></div>
<div class="am1"></div>
<br/>
 
<div class="am1"><a href="#" onclick="javascript:parent.location.href='<%=contextPath %>/logout';">閫€鍑�</a></div>
-->
<div id="treeMenu"></div>
</body>
</html>
